import { required } from 'vee-validate/dist/rules'
import { extend } from 'vee-validate'
// 验证手机号是否输入
extend('phoneRequired', {
  ...required,
  message: '请输入手机号',
})

// 验证手机号格式是否正确
const phoneReg = /^1[3-9][0-9]{9}$/
extend('phone', {
  ...required,
  validate(val) {
    return phoneReg.test(val)
  },
  message: '手机号格式不正确',
})

// 验证密码是否输入
extend('passwordRequired', {
  ...required,
  message: '请输入密码',
})

// 验证密码是否正确
const passwordReg = /^[a-zA-Z0-9_]{6,18}$/
extend('password', {
  ...required,
  validate(val) {
    return passwordReg.test(val)
  },
  message: '密码格式不正确',
})
